package com.tang.model.prototype;

import java.io.Serializable;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/8/15 16:40
 * @Desc
 * @Remarks
 */
public class Qitiandasheng extends Monkey implements Cloneable, Serializable {
    public static final long serialVersionUID = 412423412L;

    private Jingubang jingubang;

    public Jingubang getJingubang() {
        return jingubang;
    }

    public void setJingubang(Jingubang jingubang) {
        this.jingubang = jingubang;
    }

    /**
     * 浅拷贝
     * @return
     * @throws CloneNotSupportedException
     */
//    @Override
//    protected Qitiandasheng clone() throws CloneNotSupportedException {
//        return (Qitiandasheng) super.clone();
//    }

    /**
     * 深拷贝
     *
     * @return
     * @throws CloneNotSupportedException
     */
    @Override
    protected Qitiandasheng clone() throws CloneNotSupportedException {
        Object clone = super.clone();
        Qitiandasheng bak = (Qitiandasheng) clone;

        bak.setJingubang(getJingubang().clone());
        return bak;
    }

    @Override
    public String toString() {
        return "Qitiandasheng{" +
                "Monkey{" +
                "height=" + getHeight() +
                ", weight=" + getWeight() +
                ", sex=" + getSex() +
                "}," +
                "jingubang=" + jingubang +
                '}';
    }
}
